package cn.dengta.webapp.user.vo;

import cn.dengta.webapp.base.entity.BaseEntity;
import cn.dengta.webapp.base.vo.AbstractVO;
import cn.dengta.webapp.user.entity.User;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AssocTypeVO extends AbstractVO<Void> {

	protected Long id;
	protected String name;
	protected String image;
	protected String type;
	protected String tag;
	protected String info;
	protected String remark;

	public AssocTypeVO init(Long id, String name, String image, String type, String tag, String info, String remark) {
		this.id = id;
		this.name = name;
		this.image = image;
		this.type = type;
		this.tag = tag;
		this.info = info;
		this.remark = remark;
		return this;
	}

	public static AssocTypeVO of(BaseEntity entity) {
		if (entity instanceof User) {
			return ofUser((User) entity);
		}
		return null;
	}

	public static AssocTypeVO ofUser(User source) {
		return new AssocTypeVO().init(source.getId(), source.getNickname(), source.getAvatar(), source.entityName(), null, null, null);
	}

}
